<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>libmf.gex - Mike Fiorino`s Collection of GrADS Extensions</title>
<link rel="stylesheet" href="/pod.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:_www@b02.apple.com" />
</head>

<body>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block">&nbsp;libmf.gex - Mike Fiorino`s Collection of GrADS Extensions</span></strong></big>
</td></tr>
</table>

<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<ul>

		<ul>

			<li><a href="#grads_commands">GrADS Commands</a></li>
			<li><a href="#grads_functions_">GrADS Functions:</a></li>
		</ul>

	</ul>

	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#commands_provided">COMMANDS PROVIDED</a></li>
	<ul>

		<li><a href="#tcprop_expr_lon_lat_radius_bearing"><strong>tcprop</strong> <em>EXPR</em> <em>LON</em> <em>LAT</em> <em>RADIUS</em> <em>BEARING</em></a></li>
		<li><a href="#mfhilo_expr__method__options_"><strong>mfhilo</strong> <em>EXPR</em> [<em>METHOD</em>[,<em>OPTIONS</em>]</a></li>
	</ul>

	<li><a href="#functions_provided">FUNCTIONS PROVIDED</a></li>
	<ul>

		<li><a href="#smth2d_expr__n_nu1_____nun__"><strong>smth2d</strong>(<em>EXPR</em>[,<em>N</em>,<em>nu1</em>,...,<em>nuN</em>])</a></li>
		<li><a href="#uv2trw_u_v__opt___lon_lat__"><strong>uv2trw</strong>(<em>U,V</em>,[<em>OPT</em>],[<em>LON,LAT</em>])</a></li>
	</ul>

	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>libmf.gex - Mike Fiorino`s Collection of GrADS Extensions</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p>
</p>
<h3><a name="grads_commands">GrADS Commands</a></h3>
<dl>
<dt>
<dd>
<p><strong>tcprop</strong> <em>EXPR</em> <em>LON</em> <em>LAT</em> <em>RADIUS</em> - Properties relative to lon/lat</p>
</dd>
</li>
<dt>
<dd>
<p><strong>mfhilo</strong> <em>EXPR</em> [<em>METHOD</em>[,<em>OPTIONS</em>] - Find max/min or H/L in 2D field</p>
</dd>
</li>
</dl>
<p>
</p>
<h3><a name="grads_functions_">GrADS Functions:</a></h3>
<dl>
<dt>
<dd>
<p><strong>smth2d</strong>(<em>EXPR</em>[,<em>N</em>,<em>nu1</em>,...,<em>nuN</em>]) -  Shuman smoother/de-smoother</p>
</dd>
</li>
<dt>
<dd>
<p><strong>uv2trw</strong>(<em>U,V</em>,[<em>OPT</em>],[<em>LON,LAT</em>]) -  Find radial/tangential velocity</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This library implements Mike Fiorino`s collection GrADS extensions,
including his classic <em>regrid2</em> regridding function as an extension now
called <em>re2</em>, <em>smth2d</em> for applying the Shuman smoother-desmother and
computing radial/tangential velocities relative to a lat/lon point.
Commands are also provided to find H/L of a 2D field and to calculate
properties of a tropical cyclone (TC).</p>
<p>These functions were initially developed as <em>classic</em> User Defined
Function (UDFs) in GrADS v1.x. These extensions were later implemented as
<em>dynamic</em> linked extensions in GrADS v1.10.</p>
<p>
</p>
<hr />
<h1><a name="commands_provided">COMMANDS PROVIDED</a></h1>
<p>
</p>
<h2><a name="tcprop_expr_lon_lat_radius_bearing"><strong>tcprop</strong> <em>EXPR</em> <em>LON</em> <em>LAT</em> <em>RADIUS</em> <em>BEARING</em></a></h2>
<p>This command computes the <em>EXPR</em> properties relative to a point located
at <em>LON,LAT</em>, typically a tropical cyclone. The parameters are returned
to the calling GrADS script via script variable <em>result</em>.</p>
<p>Sample output:</p>
<pre>
 tcprop for expr: psl Latc:   16.80  Lonc:  129.70  Radinf:   200 [nm] Bearing:    60  Hemi1:  60-240 Hemi2: 240-420
 MAXCntRadGrad:  1.249e-02  minCntRadGrad:  8.694e-03  MeanCntRadGrad:  1.063e-02 [units: (out-ctr)/nm]
 MeanFieldInsideRadinf:     100573 
 Hemi1:         60-240  Hemi2:        240-420
 MeanHemi1:     100572  MeanHemi2:     100573 
 QuadNE:     60-150  QuadSE:    150-240  QuadSW:    240-330  QuadNW:    330-420
 MeanNE:     100598  MeanSE:     100545  MeanSW:     100548  MeanNW:     100597</pre>
<p><em>EXPR</em> - a valid GrADS expression</p>
<p><em>LON,LAT</em> - longitude/latitude of the center</p>
<p><em>RADIUS</em> - distance in nm away from <em>LON,LAT</em> to calculate properties</p>
<p><em>BEARING</em> - direction (0-360 deg) to calculate mean of the field within
<em>RADIUS</em> in four quadrants and two hemispheres, e.g., of a TC is
heading towards the West (270 deg), then <code>MeanHemi1</code> will be the right
hemisphere (North or right of track) and <code>MeanHemi2</code> the left (South or
left of the motion).  The quadrants are defined NE,SE,SW,NW relative to
<em>BEARING</em> (0 deg or North)</p>
<p>
</p>
<h2><a name="mfhilo_expr__method__options_"><strong>mfhilo</strong> <em>EXPR</em> [<em>METHOD</em>[,<em>OPTIONS</em>]</a></h2>
<p>This command finds maximun/minimum values in a 2-D lat/lon field, returning
the location and value between grid points via the GrADS script variable 
<em>result</em>.</p>
<p><em>EXPR</em> is a GrADS valid expression</p>
<p><em>METHOD</em> - can be either <em>CL</em> or <em>GR</em></p>
<p>For method <strong>CL</strong> -- Contour-Level based from NCEP -- the <em>OPTIONS</em> are</p>
<p><em>MaXMin</em> - specify <em>L</em> for lows only, <em>H</em> for highs only; A|B for both (case insensitive)</p>
<p><em>RADIUS</em> - radius in nm, default is 120, bigger radius leads to finding fewer H/L</p>
<p><em>CINTINF</em> - contour interval between max and nearby point; smaller contour interval leads to finding more negative extrema.</p>
<p>For method <strong>GR</strong> -- GRid-based written by Mike Firoino -- the <em>OPTIONS</em> are</p>
<p><em>MaXMin</em> - specify <em>L</em> for lows only, <em>H</em> for highs only; A|B for both (case insensitive)</p>
<p><em>SORTby</em> - <em>d</em> distance from either center of grid or a specified
lat/lon; <em>m</em> order by mag/value at extrema; <em>g</em> by gradient; <em>l</em> by
laplacian</p>
<p><em>PCNTILE</em> - set percentile (0-100) of top N points sorted by gradient</p>
<p><em>LATC</em> - set the latitude for distance [nm] calculations</p>
<p><em>LONC</em> - set the longitude (deg E) for distance [nm] calculations</p>
<p>sExample + output:</p>
<pre>
 vt=hcurl(u,v)*1e5</pre>
<pre>
 mfhilo vt gr b d 30 16.8 129.7</pre>
<p>output in script variable <em>result</em>:</p>
<pre>
 mfhilo GR method N: 7  maxmin: 0  pcntile:     30  latc:  16.80 lonc:  129.70
 H    16.86  129.90  M:    20.3321  G:  100.0  L:  100.0  D:   12.22  GV:     2.2897  LV:    4.82068 
 H    17.03  127.69  M:    10.4799  G:   38.7  L:   28.8  D:  115.96  GV:    0.88574  LV:    1.38745 
 L    20.56  129.96  M:    -5.2466  G:  100.0  L:  100.0  D:  226.19  GV:    1.09352  LV:    4.55874 
 L    17.94  125.36  M:  -0.435871  G:   43.6  L:   23.0  D:  257.63  GV:    0.47636  LV:    1.04821 
 L    18.10  134.23  M: 0.00436844  G:   60.2  L:   25.6  D:  270.80  GV:   0.658458  LV:    1.16751 
 L    16.06  124.95  M:  -0.726843  G:   26.8  L:   32.2  D:  276.80  GV:   0.293564  LV:    1.46846 
 L    14.40  134.67  M:   -5.43262  G:   88.4  L:   41.8  D:  321.18  GV:   0.966466  LV:    1.90383 
 
for the first output line (in grads script: sublin(result,2)):</pre>
<pre>
 H                     -- type of extrema High or Low
 16.86                 -- latitude
 129.90                -- longitude
 M:    20.3321         -- magnitude
 G:  100.0             -- percentile of gradient
 L:  100.0             -- percentile of laplacian
 D:   12.22            -- great-circle distance [nm] away from latc (16.8) and lonc (129.7)
 GV:     2.2897        -- value of gradient in grid units (dx=i+1-i = 1)
 LV:    4.82068        -- value of laplacian in grid units</pre>
<p>For method <strong>TM</strong> -- Tim Marchok, GFDL barnes-analysis scheme to locate extrema between grid points -- the <em>OPTIONS</em> are</p>
<p><em>LATC</em> - first-guess latitude</p>
<p><em>LONC</em> - first-guess longitude (deg E)</p>
<p><em>RADINF</em> - search radiusm [nm]</p>
<p><em>ICTYPE</em> - 0 -&gt; cparm='nothing special'; 1 -&gt; cparm='vmag' (special
wind speed reatment); 2 -&gt; cparm='zeta' (special vorticity treatment)</p>
<p>Example + Output:</p>
<pre>
 mfhilo vt tm 16.8 129.7</pre>
<pre>
 mfhilo TM method for expr: vt  Radinf:   250 [nm] ictype: 0 (0=&gt; cparm=''nothing special', 1=&gt; cparm='vmag'; 2=&gt; cparm='zeta'
 GuessLon:  129.70  GuessLat:   16.80
 FinalLon:  129.90  FinalLat:   16.85  FinalVal:     17.665  FinalValBesselIntrp:    20.3253</pre>
<p>
</p>
<hr />
<h1><a name="functions_provided">FUNCTIONS PROVIDED</a></h1>
<p>
</p>
<h2><a name="smth2d_expr__n_nu1_____nun__"><strong>smth2d</strong>(<em>EXPR</em>[,<em>N</em>,<em>nu1</em>,...,<em>nuN</em>])</a></h2>
<p>This function smooths a 2D field according to the Shuman (1957, MWR 357-361)
smoother-desmoother algorithm; defaults <em>N</em>=1 <em>nu1</em>=0.5 <em>nu2</em>=-0.5 (light).
For exampe,  for a 3 passes, heavy filter enter</p>
<pre>
      ga-&gt; d smth2d(psl,3,0.5)</pre>
<p><em>EXPR</em> is a GrADS valid expression</p>
<p><em>N</em> - number of fiter passes</p>
<p><em>ni1</em>,...<em>nuN</em> - smoothing coefficients</p>
<p>
</p>
<h2><a name="uv2trw_u_v__opt___lon_lat__"><strong>uv2trw</strong>(<em>U,V</em>,[<em>OPT</em>],[<em>LON,LAT</em>])</a></h2>
<p>This function returns the tangential (<em>OPT</em>=1, default) or radial (<em>OPT</em>=-1)
velocity relative to a fixed <em>LON,LAT</em>. If no <em>LON,LAT</em> is provided, 
then the center of the grid is assumed the  fixed point. For example,</p>
<pre>
      ga-&gt; d uv2trw(ua,va,-1)</pre>
<p>displays the <em>radial</em> velocity, while</p>
<pre>
      ga-&gt; d uv2trw(ua,va)</pre>
<p>displays the <em>tangential</em> velocity.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<ul>
<li>
<p><a href="http://opengrads.org/">http://opengrads.org/</a> - OpenGrADS Home Page</p>
</li>
<li>
<p><a href="http://cookbooks.opengrads.org/index.php?title=Main_Page">http://cookbooks.opengrads.org/index.php</a> -
OpenGrADS Cookbooks</p>
</li>
<li>
<p><a href="http://opengrads.org/wiki/index.php?title=User_Defined_Extensions">http://opengrads.org/wiki/index.php</a> - OpenGrADS User Defined Extensions</p>
</li>
<li>
<p><a href="http://www.iges.org/grads/">http://www.iges.org/grads/</a> - Official GrADS Home Page</p>
</li>
</ul>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Michael Fiorino (<a href="mailto:mfiorino@gmail.com">mfiorino@gmail.com</a>)</p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright (C) 2009 Michael Fiorino</p>
<p>This is free software; see the source for copying conditions.  There is
NO  warranty;  not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.</p>
<table border="0" width="100%" cellspacing="0" cellpadding="3">
<tr><td class="block" valign="middle">
<big><strong><span class="block">&nbsp;libmf.gex - Mike Fiorino`s Collection of GrADS Extensions</span></strong></big>
</td></tr>
</table>

</body>

</html>
